﻿// 项目：	Guan.CMS.Web - Guan.CMS
// 文件名：	GlobalConfig.cs
// 
// 修改时间：2013-03-09 22:02
// 修改人：	Cooclsee

using System.Linq;
using System.Web.Mvc;
using Guan.CMS.Core.Cache;
using Guan.CMS.Data.Repositories;
using Guan.CMS.Model.Entities;

namespace Guan.CMS.Web.Models
{
    public class Global
    {

        public static SiteConfig SiteConfig
        {
            get
            {
                var siteConfig = HttpCacheExtension.Get("SiteConfig") as SiteConfig;
                if (siteConfig == null)
                {
                    var siteConfigRepository = DependencyResolver.Current.GetService<ISiteConfigRepository>();
                    siteConfig = siteConfigRepository.GetList().FirstOrDefault();
                    HttpCacheExtension.Set("SiteConfig", siteConfig);
                }
                return siteConfig;
            }
        }
    }
}